
<!--这是一个测试<br/>test{$data1.name}-->
<div style="margin:2%;">
    <div class="panel">
        <div class="panel-heading">
            用户列表
        </div>
        <div class="panel-body">
            <table class="table">
                <thead>
                <tr>
                    <th>状态</th>
                    <th>#</th>
                    <th>用户名</th>
                    <th>备注</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                {foreach name="data.res" item="d" key="k"}
                <tr>
                    <td>数据表中</td>
                    <td>{$d.id}</td>
                    <td>{$d.name}</td>
                    <td>{$d.remark}</td>
                    <td>
                        <a style="color:black;text-decoration: none;" href="{:url('product/Product/edit_user',['id'=>$d['id']])}" ><i class="icon icon-pencil"></i></a>
                        <a style="color:black;text-decoration: none;" href="{:url('product/Product/del_user',['id'=>$d['id']])}" ><i class="icon icon-trash"></i></a>
                    </td>
                </tr>
                <tr>
                    <td>修改栏</td>
                    <td>{$d.id}</td>
                    <td><input type="test" name="name" id="name_{$d.id}" value="{$d.name}" onchange="edit_detail({$d.id})"></td>
                    <td><input type="text" name="remark" id="remark_{$d.id}" value="{$d.remark}"  onchange="edit_detail({$d.id})"></td>
                    <td></td>
                </tr>
                {/foreach}
                </tbody>
            </table>
        </div>
    </div>
</div>



    <form method="post" action="{:url('product/product/insert_user')}">
       <label >姓名：</label>
        <input type="text" name="name" ><br/>

        <label>密码：</label>
        <input type="text" name="pwd"><br/>

        <label>确认密码：</label>
        <input type="text" name="confirmpwd"><br/>

        <label>备注：</label>
        <textarea name="remark"></textarea><br/>

        <button type="submit" >点击我</button>
    </form>



<script>

    function edit_detail(id){
        var name = $('#name_'+id).val();
        var remark = $('#remark_'+id).val();
        var url = "{:url('product/Product/edit_detail')}";
        $.post(url,{id:id,name:name,remark:remark}, function (data) {
            if(data.msg == 1){
                alert('123');
            }else{
                alert('456');
            }
        });
    }
</script>